import locals


def hasEvent(eventName):
    for e in locals.events:
        if e['name'] == eventName:
            return e


def registerEvent(eventName, _callable):
    locals.events.append({"name": eventName, "callable": _callable})


def unregisterEvent(eventName):
    e = hasEvent(eventName)
    if e: del e


def hasUpdate(updateName):
    for e in locals.updates:
        if e['name'] == updateName:
            return e


def registerUpdate(updateName, _callable):
    locals.updates.append({"name": updateName, "callable": _callable})


def unregisterUpdate(updateName):
    e = hasEvent(updateName)
    if e: del e
